<?php
	class xl_hinhanh extends database
	{
		function LoadAll()
		{
			$sql = "Select * from hinhanh";
			$this->setQuery($sql);
			$arr = $this->loadAllRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function LayHinhAnhTheoAlbum($maalbum)
		{
			$sql = "Select * from hinhanh where maalbum='".$maalbum."'";
			$this->setQuery($sql);
			$arr = $this->loadAllRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function LayHinhAnhTheoMaHinhAnh($maalbum, $mahinhanh)
		{
			$sql = "Select * from hinhanh where maalbum = '".$maalbum."' and mahinhanh = '".$mahinhanh."'";
			$this->setQuery($sql);
			$arr = $this->loadAllRow();
			$this->disconnect(); 
			return $arr;
		}
		
		function XoaHinhAnh($maalbum, $mahinhanh)
		{
			$sql ="delete from hinhanh where maalbum = '".$maalbum."' and mahinhanh = '".$mahinhanh."'";
			$this->setQuery($sql);
			return $this->query();			
		}
		
		function ThemHinhAnh($maalbum, $tenhinhanh, $duongdan, $thumbnail, $ngaytao, $manguoidung)
		{
			$sql = "INSERT INTO hinhanh(maalbum, tenhinhanh, duongdan, thumbnail, ngaytao, manguoidung) VALUES ('".$maalbum."','".$tenhinhanh."','".$duongdan."','".$thumbnail."','".$ngaytao."','".$manguoidung."')";			
			$this->setQuery($sql);
			return $this->query();
			//return $sql;
			
		}
	
		
		
	}
?>